id/email
password
forgot password | create account
about | help | prefs
ReadingBatcode reading practice

 

 

Athenian: Grab BagFibonacci

prev  |  next  |  chance

Fibonacci problem.
By Benji '24

def fibonacci(n):
    a = 1
    prev = 0
    cur = 1
    while a <= n:
        next = prev + cur
        prev = cur
        cur = next
        a += 1
    return cur
Function Call  Return Value
fibonacci(0)
fibonacci(1)
fibonacci(2)
fibonacci(3)
fibonacci(6)
fibonacci(9)

Experiment with this code on Gitpod.io

⬅ Back